divide
Type
command
Summary
Divides a container by a number and places the resulting value in the container.
Syntax
divide [<chunk> of] <container> by <number>
divide <arrayContainer> by {<number> | <array>}
Description
Use the divide command to divide a container or a portion of a container by a number, or to divide two arrays containing numbers.
The contents of the container (or the chunk of the container) must be a number or an expression that evaluates to a number.
If an arrayContainer is divided by a number, each element is divided by the number. If an arrayContainer is divided by an array, both arrays must have the same number of elements and the same dimension, and each element in the arrayContainer is divided by the corresponding element of the array.
If the container or an element of the arrayContainer is empty, the divide command treats its contents as zero.
If a math operation on finite inputs produces a non-finite output, an execution error is thrown. See math operations for more information.
Parameters
Name | Type | Description |
---|---|---|
chunk | A chunk expression specifying a portion of the container. | |
container | A field, button, or variable, or the message box. | |
number | Any expression that evaluates to a number. | |
arrayContainer | array | |
array | array |
Examples
divide field 1 by 52
divide field "Total Income" by 12
divide line x of field "Expenses" by percentageRate
put 100 into tValue
divide tValue by 2
Related
command: multiply
glossary: property, element, container, expression, array, evaluate, command, math operation
keyword: field, element, button
operator: slash
property: numberFormat
Compatibility and Support
Introduced
LiveCode 1.0
OS
mac
windows
linux
ios
android
Platforms
desktop
server
mobile